import '../../util/http.dart';
import 'package:flutter/material.dart';

class Account{

  BuildContext? context;

  static Account of(BuildContext? context){
    Account account = Account();
    account.context = context;
    return account;
  }
  /// 用户登录
  Future<dynamic> login(String userName, String password) async{
     return await ApiService.of(context).post("sys/account/login", {'account': userName, 'password': password});
  }

  /// 获取用户信息
  Future<dynamic> userInfo() async{
    return await ApiService.of(context).get("sys/account/userInfo");
  }

  /// token 检查
  Future<dynamic> checkToken(token) async{
    return await ApiService.of(context).get("sys/account/checkToken/"+ token);
  }

  /// 修改密码
  Future<dynamic> modifyPassword(String password) async{
    return await ApiService.of(context).put('sys/account/modifyPassword/'+password, null);
  }
}